package system;

import java.io.File;

public class Text extends Actor{

	String text;
	int val;
	
	public Text(int value, float textX, float textY, String filename, int width, int height) throws Exception{
		super(Character.toString((char)value), new AnimatedSprite(new File("assets/fonts/" + filename + ".png"), width, height, false, 0), textX, textY);
		setVal(value);
	}
	
	public Text(int value, float textX, float textY, String filename) throws Exception{
		this(value, textX, textY, filename, 7, 10);
	}
	
	public Text(char c, float textX, float textY, String filename) throws Exception{
		this((int)c, textX, textY, filename);
		setVal((int)c);
		
	}
	
	public int getVal(){
		return val;
	}
	
	public void setVal(int newVal){
		if(newVal >= 48 && newVal <= 57){
			val = newVal-48;
		}
		else if(newVal >= 65 && newVal <= 91){
			val = newVal-55;
		}
		else{
			val = 36;
		}
		sprite.setFrameIndex(val);
		setName(Character.toString((char)val));
	}
}
